package algorithm;

import java.util.HashSet;
import java.util.Set;

public class leetcode_0136 {
    public int singleNumber(int[] nums) {
        Set set=new HashSet();
        for(int num:nums){
            if(set.contains(num)){
                set.remove(num);
            }
            else{
                set.add(num);
            }
        }
        return (int) set.toArray()[0];

    }
}
